<template>
  <el-form :model="formData" label-width="120px" ref="form" v-loading="loading" class="pr-4">
    <el-form-item label="备注" prop="remarks">
      <el-input v-model="formData.remarks" name="remarks" clearable />
    </el-form-item>
    <el-form-item label="采购订单id" prop="purchaseorder_id">
      <el-input v-model="formData.purchaseorder_id" name="purchaseorder_id" clearable />
    </el-form-item>
    <el-form-item label="物流行号id" prop="purchaseorderschedule_id">
      <el-input v-model="formData.purchaseorderschedule_id" name="purchaseorderschedule_id" clearable />
    </el-form-item>
    <el-form-item label="数量" prop="quantity">
      <el-input v-model="formData.quantity" name="quantity" clearable />
    </el-form-item>
    <el-form-item label="送货日期" prop="deliverydate">
      <el-date-picker v-model="formData.deliverydate" type="date" placeholder="选择送货日期" :size="size" />
    </el-form-item>
    <el-form-item label="已暂收的数量" prop="thequantity">
      <el-input-number v-model="formData.thequantity" :min="1"  />
    </el-form-item>
    <el-form-item label="品名列表ID" prop="suppliernamedelivery_id">
      <el-input v-model="formData.suppliernamedelivery_id" name="suppliernamedelivery_id" clearable />
    </el-form-item>
    <el-form-item label="箱号" prop="number">
      <el-input v-model="formData.number" name="number" clearable />
    </el-form-item>
    <div class="flex justify-end">
      <el-button type="primary" @click="submitForm(form)">{{ $t('system.confirm') }}</el-button>
    </div>
  </el-form>
</template>
  
  <script lang="ts" setup>
import { useCreate } from '/admin/composables/curd/useCreate'
import { useShow } from '/admin/composables/curd/useShow'
import { onMounted } from 'vue'

const props = defineProps({
  primary: String | Number,
  api: String,
})

const { formData, form, loading, submitForm, close } = useCreate(props.api, props.primary)

if (props.primary) {
  useShow(props.api, props.primary, formData)
}

const emit = defineEmits(['close'])
onMounted(() => {
  close(() => emit('close'))
})
</script>
  